package com.djp.smartapp.util;

import android.content.Context;

import com.djp.smartapp.bean.UserLineResponse;
import com.google.gson.Gson;

public class Line {

    private static Gson gson;

    /**
     * 必须在线程调用，判断是否已经创建了学生生产线
     * @param context
     * @return
     */
    public static boolean lineIsReady(Context context){
        int userLineId = LineSpUtil.getUserLineId(context);
        String res = OkHttpUtil.getOkHttpUtil().getPostRes("UserProductionLine/search", "id=" + userLineId);
        gson = new Gson();
        UserLineResponse userLineResponse = gson.fromJson(res, UserLineResponse.class);
        try {
            userLineResponse.getData().get(0);
            return true;
        } catch (NullPointerException e) {
            return false;
        }
    }
}
